package offer.diff;

import java.util.Arrays;

/**
 * https://www.nowcoder.com/practice/762836f4d43d43ca9deb273b3de8e1f4?tpId=13&tqId=11198&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking&from=cyc_github&tab=answerKey
 * @author DengYuan2
 * @create 2021-04-20 9:49
 */
public class n_61 {
    public static void main(String[] args) {

    }

    public boolean IsContinuous(int [] numbers) {
        if (numbers==null || numbers.length==0){
            return false;
        }
        int zeroCnt=0;
        Arrays.sort(numbers);
        int min=0;
        int max=0;

        for (int i = 0; i < 5; i++) {
            if (numbers[i]==0){
                zeroCnt++;
            }else {
                if (i>=1 && numbers[i]==numbers[i-1]){
                    return false;
                }
            }
        }
        min=numbers[zeroCnt];
        max=numbers[4];
        if (max-min>=5){
            return false;
        }
        return true;
    }
}
